<template>
	<view class="container">
		<view class="text-left padding-lg solid-bottom">
			<view class="text-lg padding-bottom-sm text-left">{{ articleInfo.title }}</view>
			<view class="cu-tips text-gray">{{ articleInfo.create_time }}</view>
		</view>
		<view class="padding-lg">
			<u-parse :content="articleInfo.content" @preview="preview" @navigate="navigate" :imageProp="imageProp"></u-parse>
		</view>
	</view>
</template>

<script>
	import uParse from '@/components/u-parse/u-parse.vue';
	export default {
		components: {
			uParse
		},
		data() {
			return {
				article_id:0,
				articleInfo:[],
				classifyInfo:[],
				imageProp:{}
			};
		},
		onLoad: function (option) {
			this.imageProp = {'mode':'aspectFit','domain':this.weburl};
			this.article_id = option.id;
			this.helper.checkLogin();
			this.getData();
		},
		methods: {
			getData:function(){
				//获取基础参数
				// uni.showLoading({
				// 	title:"数据加载中",
				// 	mask:true
				// })
				let id = this.article_id;
				let timestamp = this.helper.now();
				let sign = this.helper.setSign(['id='+id,'timestamp='+timestamp]);
				this.helper.req({
					api:"getArticle",
					timestamp:timestamp,
					data:{id:id},
					header:{sign:sign},
					method:'GET',
				}).then(res=>{
					this.classifyInfo = res.data.data.classifyInfo;
					this.articleInfo = res.data.data.articleInfo;

					uni.setNavigationBarTitle({
						title: this.classifyInfo.name
					});
					
					uni.hideLoading();
				})
			},
		},
	};
</script>

<style lang="scss">
	page {
		height: 100%;
	}
	.container {
		width: 100%;
		height: 100%;
		overflow: hidden;
	}
	.container {
	    display: -webkit-box;
	    display: -webkit-flex;
	    display: flex;
	    -webkit-box-orient: vertical;
	    -webkit-box-direction: normal;
	    -webkit-flex-direction: column;
	    flex-direction: column;
	    height: 100%;
	    background: #fff;
	}
</style>
